﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ITProject.Domain.Entities;

namespace ITProject.WebUI.Models.Project
{
    public class StatusChangeViewModel
    {
        public DateTime DateOfChange { get; set; }
        public string Comment { get; set; }
        public string OldStatus { get; set; }
        public string NewStatus { get; set; }
        public string User { get; set; } // użytkownik zmieniający status

        public static StatusChangeViewModel Convert(StatusChange statusChange, string userName)
        {
            StatusChangeViewModel vm = new StatusChangeViewModel();
            vm.Comment = statusChange.Comment;
            vm.DateOfChange = statusChange.DateOfChange;
            vm.OldStatus = StatusName.ConvertFromByteNullable(statusChange.OldStatus);
            vm.NewStatus = StatusName.ConvertFromByte(statusChange.NewStatus);
            vm.User = userName;
            return vm;
        }
    }
}